FROM node:24-alpine
WORKDIR /app

ARG PUBLIC_SERVICE_URL
ARG INTERNAL_SERVICE_URL
ARG OIDC_CACHE_KEY_PREFIX
ARG OIDC_CACHE_KEY_ID_TOKEN_SUFFIX
ARG PUBLIC_AUTH_NAMESPACE

ENV PUBLIC_SERVICE_URL=$PUBLIC_SERVICE_URL
ENV INTERNAL_SERVICE_URL=$INTERNAL_SERVICE_URL
ENV PUBLIC_OIDC_CACHE_KEY_PREFIX=$OIDC_CACHE_KEY_PREFIX
ENV PUBLIC_OIDC_CACHE_KEY_ID_TOKEN_SUFFIX=$OIDC_CACHE_KEY_ID_TOKEN_SUFFIX
ENV PUBLIC_AUTH_NAMESPACE=$PUBLIC_AUTH_NAMESPACE

COPY package*.json ./
RUN npm install
COPY . .

RUN npm run build

EXPOSE 4321
CMD ["node", "dist/server/entry.mjs"]